package com.spring5.learning.controller;

import com.spring5.learning.service.CommandManager;
import com.spring5.learning.service.HelloWorldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xin
 * @version 1.0
 */
@RestController
@RequestMapping("/hello")
public class HelloWorldController {

    @Autowired
    private HelloWorldService helloWorldService;

    @Autowired
    private CommandManager commandManager;

    @GetMapping("/say")
    public String hello() {
        commandManager.process("new");
        return helloWorldService.hello();
    }
}
